<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductCustomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_customs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('product_id')->comment('产品ID');
            $table->char('unique', 11)->unique()->comment('海关料号');
            $table->char('code', 10)->comment('海关编码');
            $table->string('name', 255)->comment('海关品名');
            $table->char('unit', 3)->comment('申报单位');
            $table->char('unit1', 3)->comment('法定计量单位代码');
            $table->char('unit2', 3)->nullable()->comment('法定第二计量单位代码');
            $table->double('qy1')->comment('法定第一数量');
            $table->double('qy2')->nullable()->comment('法定第二数量');
            $table->char('country', 3)->nullable()->comment('原产国');
            $table->double('net_weight')->nullable()->comment('净重');
            $table->string('element', 255)->comment('申报要素');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_customs');
    }
}
